#!/bin/sh

cat << EOF > dummy.c
#include <stdio.h>
#include <time.h>

int main ()
{
  time_t seconds = 3600 * (24 * 36525 / 5 + 12);  /* 1990-01-01, noon UTC */
  struct tm *t = localtime (&seconds);
  char buf [100];
  strftime (buf, 100, "%W", t);
  printf ("%s\n", buf);
  return 0;
}
EOF

if gcc dummy.c > /dev/null 2>&1 && [ -r "$A_OUT" ]; then
  rm -f dummy.c
  if [ x"`./"$A_OUT"`" = x"01" ]; then
    rm -f "$A_OUT"
    $1 $2
    if [ -r "$A_OUT" ] ; then
      ./"$A_OUT"
    else
      echo "failed"
    fi
  else
    echo "SKIPPED: bug in strftime() (this is a libc bug, not a GPC bug)"
  fi
else
  rm -f dummy.c
  echo "failed: could not compile strftime() test program"
fi
